package com.glls.sbdemo22.config;

import com.glls.sbdemo22.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @date 2023/5/16
 * @desc  webmvc 的   配置类
 */
@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 实现WebMvcConfigurer不会导致静态资源被拦截
        registry.addInterceptor(new MyInterceptor())
                // 放行 某些请求路径
                .excludePathPatterns("/webjars/**","/swagger-resources/**","/doc.html")
                //拦截 路径
                .addPathPatterns("/**");
    }


}
